/*
 * led_indicate.h
 *
 *  Created on: 09.05.2013
 *      Author: Roma Jam
 */

#ifndef LED_INDICATE_H_
#define LED_INDICATE_H_


#include "kl_lib_l15x.h"

// HW
#define LED_GPIO 	GPIOA
#define REDLED_P	1
#define ORGLED_P	3
#define BLULED_P	2

// Indicate
#define BLINK_TIME	49 // 50 ms

// Implement
enum LedColor_t { lcRed, lcOrange, lcBlue };
enum LedState_t { lsOn, lsOff, lsBlink };

class Led_Ind_t {
private:
	uint32_t Timer;
	LedColor_t CurrentColor;
	Ports_t Red, Orange, Blue;
//	void On(void);
public:
	void On(void); // Need for debugging
	LedState_t State;
	void Off(void);
	void SetColor(LedColor_t lcNewColor) { Off(); CurrentColor = lcNewColor; On(); }
	void Blink() 	{ if(State == lsOn) { Off(); State = lsBlink; Delay.Reset(&Timer); } }
 	void Init();
	void Task();
};
extern Led_Ind_t Led;

#endif /* LED_INDICATE_H_ */
